import request from '../utils/request';

// 获取所有帖子
export const getPosts = () => {
  // return request.get('/posts');
  return request.get('/collections/posts/records');
};

// 根据ID获取帖子
export const getPostById = (id) => {
  return request.get(`/posts/${id}`);
};

// 创建新帖子
export const createPost = (data) => {
  return request.post('/posts', data);
};

// 更新帖子
export const updatePost = (id, data) => {
  return request.put(`/posts/${id}`, data);
};

// 删除帖子
export const deletePost = (id) => {
  return request.delete(`/posts/${id}`);
};

export default {
    getPosts,
    getPostById,
    createPost,
    updatePost,
    deletePost,
    // ...其他方法
}